package com.dionysun.graphqlkickstart.resolvers;

import com.coxautodev.graphql.tools.GraphQLResolver;
import com.dionysun.graphqlkickstart.dao.UserRepository;
import com.dionysun.graphqlkickstart.entity.Article;
import com.dionysun.graphqlkickstart.entity.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class ArticleResolver implements GraphQLResolver<Article> {
    private static final Logger LOG = LoggerFactory.getLogger(ArticleResolver.class);
    private final UserRepository userRepository;

    public ArticleResolver(UserRepository userRepository) {
        this.userRepository = userRepository;
    }

    public User author(Article article) {
        LOG.info("article {}", article);
        return User.builder().id(12L).nickname("hello").mail("123456").build();
    }

}
